<div class="rounded table" style="width: 98%;">
    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="box_top">
        <thead class="thead">
            <tr class="space">
                <th colspan="10">支付方式</th>
            </tr>
        </thead>
    </table>
    <div class="contentbox" data-uri='{:U("Admin/Role/doEditStatus")}'>
        <table width="100%" class="list td_align">
            <thead>
                <tr class="thead">
                    <th class="align-center">支付方式名称</th>
                    <th class="align-center">插件版本</th>
                    <th class="align-center">插件作者</th>
                    <th class="align-center">描述</th>
                    <th class="align-center">排序</th>
                    <th class="align-center">管理操作</th>
                </tr>
            </thead>
            <tbody>
            <volist name="data.data" id="list">
                <tr>
                    <td class="align-center">{$list.pay_name}</td>
                    <td class="align-center">{$list.pay_version}</td>
                    <td class="align-center">{$list.pay_author}</td>
                    <td class="align-center">{$list.pay_desc}</td>
                    <td class="align-center">{$list.pay_order}</td>
                    <td class="align-center">
                        <!--                        <eq name="list.pay_status" value="1">
                                                    <a href='{:U("Admin/Links/editLinks","id=$vo[id]")}' title="编辑"><img src="__PUBLIC__/Admin/images/icons/icon_edit.png" alt="编辑" title="编辑" /></a>
                                                    <a href="javascript:void(0);" title="删除" class="doDel" val="{$vo.id}" data-uri='{:U("Admin/RoleNav/doDelete","id=$vo[id]")}' data-acttype="ajax"><img src="__PUBLIC__/Admin/images/icons/icon_square_close.png" alt="删除" title="删除" /></a>
                                                <else />
                                                    <a href='{:U("Admin/Links/editLinks")}' title="安装">安装</a>
                                                </eq>-->
                        <div class="button-group">
                            <eq name="list.pay_status" value="1">
                                <a href='javascript:void(0);'  class="button danger icon pill settings doadd" pay_name="{$list.pay_name}" pay_id="{$list.pay_id}" alt="配置" title="配置" type="settings"></a>
                                <a href="javascript:void(0);"  data-uri='{:U("Admin/Payment/doDelete","pay_id=$list[pay_id]")}' val="{$list[pay_id]}" data-msg="确定要删除 <font color='red'>{$list.pay_name}</font> 吗？" data-acttype="ajax" class="button danger icon pill remove dodel" title="删除"></a>
                            <else />
                                <a href='javascript:void(0);'  class="button danger icon pill install doadd" alt="安装" title="安装" pay_name="{$list.pay_name}" pay_code="{$list.pay_code}" type="install" style="-webkit-border-radius: 50em;"></a>
                            </eq>

                        </div>
                    </td>
                </tr>
            </volist>
            <empty name="data">
                <tr><td colspan="99">暂时没有数据!</td></tr>
            </empty>
            </tbody>
        </table>
        <div style="clear: both;"></div>
    </div>

</div>
<script>
    $(document).ready(function(){
        //安装/编辑支付列表
        $('.button-group a.doadd').live('click', function(){
            var name = $(this).attr("pay_name");
            var id = $(this).attr("pay_id");
            var type = $(this).attr("type");
            var code = $(this).attr("pay_code");
            var typenames;
            if(type == 'settings'){
                typenames = '修改';
            }else{
                typenames = '安装';
            }

            var dialog = $.dialog({
                id:'add', 
                width:740,
                padding:'0px',
                title: typenames +' -- '+name, 
                resize: false,
                drag: false,
                cancel: true,
                ok: function () {
                    var res = $("#formvalidate").valid(); 
                    var uri = "{:U('Admin/Payment/doSavePayment')}";
                    if(res){
                        var data = $("#formvalidate").serialize();
                        //document.formvalidate.submit();
                        $.post(uri, data, function(msgObj) {
                            showMessage(msgObj.status,msgObj.info,"{:U('Admin/Payment/index')}",3);
                            return false;
                        }, 'json');
                    }else{
                        return false;
                    }
                },
                lock:true
            });
            //var dialog = $.dialog.get('add');
            if(type == 'settings'){
                var url = '/Admin/Payment/addPayment?id='+id+'&pay_name='+name+'&type='+type;
            }else{
                var url = '/Admin/Payment/addPayment?code='+code+'&type='+type;
            }
            
            $.get(url, function(html){
                dialog.content(html);
            });
//            dialog.shake && dialog.shake();// 调用抖动接口
        });
        
        //卸载支付列表
        $(".dodel").click(function(){
            var title = $(this).attr("data-msg");
            var pay_id = $(this).attr("val");
            var uri = $(this).attr("data-uri");
            $.dialog.confirm(title, function () {
                $.ajax({
                    url:uri,
                    cache:false,
                    dataType:'json',
                    type:'GET',
                    data:{},
                    success:function(msgObj){
                        showMessage(msgObj.status,msgObj.info,"{:U('Admin/Payment/index')}");
                        return false;
                    }
                });
            }, function () {
            });
        });
    });
</script>